<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>清理数据</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<!-- load css -->
<link rel="stylesheet" th:href="@{/css/font.css}" />
<link rel="stylesheet" th:href="@{/css/xadmin.css}" />
<script type="text/javascript" th:src="@{/js/jquery.min.js}"></script>
<script th:src="@{/js/layui/layui.js}" charset="utf-8"></script>
<script type="text/javascript" th:src="@{/js/xadmin.js}"></script>
</head>
<style type="text/css">
	#updateBtn{
		height:38px;
		border:0px;
		background:#00BFFF;
		color:#fff;
		padding:5px 16px;
		cursor: pointer;
	}
</style>
<body>
<!-- <div class="form-body" style="border: solid 1px; margin-top: 5%;line-height: 20px;" align="center"> -->
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a>系统设置</a>
        <a><cite>清理数据</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">
      <div class="layui-row">
        <div class="layui-form layui-col-md12 x-so">
          <input type="text" name="sTimeStr" id="sTimeStr" readonly="readonly"
		    placeholder="开始日期" class="layui-input inputHeight"
			style="margin-top: 2px;"> 
			<input type="text" name="eTimeStr" id="eTimeStr" readonly="readonly"
		    placeholder="结束日期" class="layui-input inputHeight"
			style="margin-top: 2px;margin-left: 10px;"> 
			<p style="margin-top: 20px;"><span style="margin-right: 10px;font-weight: bold;">交易记录</span><input type="checkbox" id="order" name="order" value="order"/>
			<span style="margin-right: 10px;font-weight: bold;margin-left: 15px;">充值订单</span><input type="checkbox" id="charge" name="charge" value="charge"/>
			<span style="margin-right: 10px;font-weight: bold;margin-left: 15px;">操作日志</span><input type="checkbox" id="log" name="log" value="log"/>
			<!-- <span style="margin-right: 10px;font-weight: bold;margin-left: 15px;">短信记录</span><input type="checkbox" id="msg" name="msg" value="msg"/> -->
			</p>
          <p style="margin-top: 20px;"><button id="clearBtn" data-type="reload" class="layui-btn"  lay-submit="" lay-filter="sreach" style="margin-top: 10px;"><i class="layui-icon">清理数据</i></button></p>
        </div>
      </div>
      <table class="layui-hide" id="table1" lay-filter="tool1"></table>
      </div>
<script>
layui.use(['laydate', 'laypage', 'table'], function(){
    var laydate = layui.laydate;
    
    var endDate = laydate.render({//渲染结束时间选择  
    	elem : '#sTimeStr',//通过id绑定html中插入的end  
    	done : function(value, dates) {
    	}
    });
    var endDate = laydate.render({//渲染结束时间选择  
    	elem : '#eTimeStr',//通过id绑定html中插入的end  
    	done : function(value, dates) {
    	}
    });
    
    
    $('#clearBtn').on('click', function(){
    	layer.confirm('确认清除？', function(index){
    		var startTimeStr=$('#sTimeStr').val();
    		var endTimeStr=$('#eTimeStr').val();
    		var order=$('#order').prop('checked');
    		var charge=$('#charge').prop('checked');
    		var log=$('#log').prop('checked');
    		var msg=$('#msg').prop('checked');
    		if(startTimeStr=='')
    		{
    			layer.msg("请选择开始时间");
    			return;
    		}
    		if(endTimeStr=='')
    		{
    			layer.msg("请选择结束时间");
    			return;
    		}
    		if(startTimeStr>endTimeStr)
    		{
    			layer.msg("开始时间不能大于结束时间");
    			return;
    		}
    		if(!order&&!charge&&!log&&!msg)
    		{
    			layer.msg("请选择清除项");
    			return;
    		}
    		 $.post('[[@{/admin/config/clear.html}]]',{'startTimeStr':startTimeStr,'endTimeStr':endTimeStr,'order':order,'log':log,'charge':charge,'msg':msg},function(result)
    	    		{
    			 layer.msg(result.msg,function(){location.reload();});
    	    }) 
    	})
   });
})
</script>
</body>
</html>
